package com.qj.yantaishan.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qj.yantaishan.domain.StoreNews;
import com.qj.yantaishan.mapper.StoreNewsMapper;
import com.qj.yantaishan.service.IStoreNewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 店铺新闻表(StoreNews)表服务实现类
 *
 * @author makejava
 * @since 2022-09-28 10:31:34
 */
@Service
@Primary
public class StoreNewsServiceImpl extends ServiceImpl<StoreNewsMapper, StoreNews> implements IStoreNewsService {
    @Autowired
    private StoreNewsMapper StoreNewsMapper;

    @Override
    public List<StoreNews> selectLastThr(){
        QueryWrapper<StoreNews> wrapper = new QueryWrapper<>();
        wrapper.select().orderByDesc("add_time");
        wrapper.last("limit 3");
        List<StoreNews> list = StoreNewsMapper.selectList(wrapper);
        return list;
    }
}
